﻿using System;
using System.Collections.Generic;
using System.Text;
using TarreOA.TarreOAModels;
using TarreOA.TarreOADAL;

namespace TarreOA.TarreOABLL
{
    public class DiscussAreaService
    {
        /// <summary>
        /// 存储新建讨论分区信息
        /// </summary>
        /// <param name="daTitle"></param>
        /// <param name="createTime"></param>
        /// <returns></returns>
        public int SaveDiscussAreaInfo(string daTitle, DateTime createTime)
        {
            DiscussAreaDAO daDAO = new DiscussAreaDAO();
            return daDAO.SaveDiscussAreaInfo(daTitle, createTime);
        }

        /// <summary>
        /// 根据讨论分区编号查找分区信息
        /// </summary>
        /// <param name="daid"></param>
        /// <returns></returns>
        public DiscussArea findById(int daid)
        {
            DiscussAreaDAO daDAO = new DiscussAreaDAO();
            return daDAO.findById(daid);
        }

        /// <summary>
        /// 查找所有讨论分区信息
        /// </summary>
        /// <returns></returns>
        public List<DiscussArea> findALL()
        {
            DiscussAreaDAO daDAO = new DiscussAreaDAO();
            return daDAO.findALL();
        }

        /// <summary>
        /// 更新讨论分区信息
        /// </summary>
        /// <param name="daTitle"></param>
        /// <param name="daid"></param>
        /// <returns></returns>
        public int UpdateDiscussAreaInfo(string daTitle, DateTime lastWriteTime, int daid)
        {
            DiscussAreaDAO daDAO = new DiscussAreaDAO();
            return daDAO.UpdateDiscussAreaInfo(daTitle, lastWriteTime, daid);
        }

        /// <summary>
        /// 根据分区编号删除此讨论区
        /// </summary>
        /// <param name="daid"></param>
        /// <returns></returns>
        public int DelDiscussAreaInfoById(int daid)
        {
            DiscussAreaDAO daDAO = new DiscussAreaDAO();
            return daDAO.DelDiscussAreaInfoById(daid);
        }
    }
}
